#!/bin/bash

ENV_NAME='helixfold'
CUDA=11.6

# Install py env
conda update -qy conda \
    && conda create -n ${ENV_NAME} -y -c conda-forge \
      openmm=7.5.1 \
      cudatoolkit=11.6 \
      pdbfixer \
      pip \
      python=3.7

# Check if you do not have these installed on your system.
conda install -y -c bioconda aria2 -n ${ENV_NAME}
conda install -y -c bioconda hmmer==3.3.2 hhsuite==3.3.0 kalign2==2.04 -n ${ENV_NAME}

wget -q -P alphafold_paddle/common/ \
  https://git.scicore.unibas.ch/schwede/openstructure/-/raw/7102c63615b64735c4941278d92b554ec94415f8/modules/mol/alg/src/stereo_chemical_props.txt

/opt/conda/envs/${ENV_NAME}/bin/python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
/opt/conda/envs/${ENV_NAME}/bin/python -m pip install --upgrade pip \
    && /opt/conda/envs/${ENV_NAME}/bin/python -m pip install -r requirements.txt

OPEN_MM_PATCH=$(pwd $0)/openmm.patch
pushd /opt/conda/envs/${ENV_NAME}/lib/python3.7/site-packages
patch -p0 < $OPEN_MM_PATCH
popd